<?php
class ModelCommunitySuperPolice extends Model {
	public function getSuperPolices(){
		$sql = "SELECT cp.*,cc.title as communty_name FROM `" . DB_PREFIX . "config_police_to_super` cpts left join ".DB_PREFIX."config_police cp on(cp.police_id=cpts.police_id) left join ".DB_PREFIX."config_community cc on(cc.community_id=cp.community_id) ";
		return $this->db->query($sql)->rows;
	}

	public function addSuperPolice($data= array()){
		$this->db->query('delete from '.DB_PREFIX."config_police_to_super ");

		if(isset($data['police_route'])){
		 	foreach ($data['police_route'] as $police_id) {
		 		$this->db->query('insert into  '.DB_PREFIX."config_police_to_super set police_id='".(int)$police_id."' ");
		 	}
		}

	}

}
?>